using UnityEngine;
using UnityEngine.EventSystems;

namespace MaterialUI
{
	[ExecuteInEditMode]
	[AddComponentMenu("MaterialUI/Material Radio Group", 100)]
	public class MaterialRadioGroup : UIBehaviour
	{
		[SerializeField]
		private bool m_IsControllingChildren;

		[SerializeField]
		private float m_AnimationDuration;

		[SerializeField]
		private Color m_OnColor;

		[SerializeField]
		private Color m_OffColor;

		[SerializeField]
		private Color m_DisabledColor;

		[SerializeField]
		private bool m_ChangeGraphicColor;

		[SerializeField]
		private Color m_GraphicOnColor;

		[SerializeField]
		private Color m_GraphicOffColor;

		[SerializeField]
		private Color m_GraphicDisabledColor;

		[SerializeField]
		private bool m_ChangeRippleColor;

		[SerializeField]
		private Color m_RippleOnColor;

		[SerializeField]
		private Color m_RippleOffColor;

		public bool isControllingChildren
		{
			get
			{
				return m_IsControllingChildren;
			}
			set
			{
				m_IsControllingChildren = value;
			}
		}

		public float animationDuration
		{
			get
			{
				return m_AnimationDuration;
			}
			set
			{
				m_AnimationDuration = value;
			}
		}

		public Color onColor
		{
			get
			{
				return m_OnColor;
			}
			set
			{
				m_OnColor = value;
			}
		}

		public Color offColor
		{
			get
			{
				return m_OffColor;
			}
			set
			{
				m_OffColor = value;
			}
		}

		public Color disabledColor
		{
			get
			{
				return m_DisabledColor;
			}
			set
			{
				m_DisabledColor = value;
			}
		}

		public bool changeGraphicColor
		{
			get
			{
				return m_ChangeGraphicColor;
			}
			set
			{
				m_ChangeGraphicColor = value;
			}
		}

		public Color graphicOnColor
		{
			get
			{
				return m_GraphicOnColor;
			}
			set
			{
				m_GraphicOnColor = value;
			}
		}

		public Color graphicOffColor
		{
			get
			{
				return m_GraphicOffColor;
			}
			set
			{
				m_GraphicOffColor = value;
			}
		}

		public Color graphicDisabledColor
		{
			get
			{
				return m_GraphicDisabledColor;
			}
			set
			{
				m_GraphicDisabledColor = value;
			}
		}

		public bool changeRippleColor
		{
			get
			{
				return m_ChangeRippleColor;
			}
			set
			{
				m_ChangeRippleColor = value;
			}
		}

		public Color rippleOnColor
		{
			get
			{
				return m_RippleOnColor;
			}
			set
			{
				m_RippleOnColor = value;
			}
		}

		public Color rippleOffColor
		{
			get
			{
				return m_RippleOffColor;
			}
			set
			{
				m_RippleOffColor = value;
			}
		}

		public void Refresh()
		{
			if (m_IsControllingChildren)
			{
				for (int i = 0; i < GetComponentsInChildren<MaterialRadio>().Length; i++)
				{
					MaterialRadio materialRadio = GetComponentsInChildren<MaterialRadio>()[i];
					materialRadio.animationDuration = m_AnimationDuration;
					materialRadio.onColor = m_OnColor;
					materialRadio.offColor = m_OffColor;
					materialRadio.disabledColor = m_DisabledColor;
					materialRadio.changeGraphicColor = m_ChangeGraphicColor;
					materialRadio.graphicOnColor = m_GraphicOnColor;
					materialRadio.graphicOffColor = m_GraphicOffColor;
					materialRadio.graphicDisabledColor = m_GraphicDisabledColor;
					materialRadio.changeRippleColor = m_ChangeRippleColor;
					materialRadio.rippleOnColor = m_RippleOnColor;
					materialRadio.rippleOffColor = m_RippleOffColor;
				}
			}
		}

		protected override void Start()
		{
			base.Start();
			Refresh();
		}
	}
}
